<template>
    <div class="nav_wraper">
        <div class="nav_bar">
            <div class="logo">LOGO</div>

            <!-- 一级菜单 -->
            <div class="nav_menu" @mouseout="hideSubMenu">
                <div class="menu_item"
                    v-for="(item, index) in menu_list" :key="index" @mouseover="showSubMenu(index)">
                    <div>
                        {{item.title}}
                    </div>
                </div>
                <div class="nav1">中日未来产业中心</div>
            </div>
            <!-- END -->

            <!-- 二级菜单 -->
            <div class="sub_menu hide" @mouseout="hideSubMenu" @mouseover="showSubMenu(-1)">
                <div class="inner_box"
                    v-show="menu_item_index == index"
                    v-for="(item, index) in menu_list"
                    :key="index">

                    <div class="sub_inner_box">
                        <div class="title">{{item.title}}</div>
                        <div class="wraper">
                            <div class="sub_row" v-for="(item1, ind) in item.list" :key="ind">
                                <span class="bold">{{item1.menu_title}} :</span>
                                <a href="" class="menu" v-for="(item2, ind2) in item1.menus" :key="ind2">{{item2}}</a>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <!-- END -->

        </div>

    </div>
</template>
<script>
export default {
    name: "index",
    data() {
        return {
            // 当前鼠标移入的分类菜单下标
            menu_item_index: 0,
            // 分类菜单数据
            menu_list:[{
                title:'手机配件',
                list:[{
                    menu_title:'手机通讯',
                    menus:['手机','手机维修','以旧换新']
                },
                {
                    menu_title:'手机配件',
                    menus:['手机壳','手机存储卡','数据线','充电器','电池']
                },
                {
                    menu_title:'运营商',
                    menus:['中国联通','中国移动','中国电信']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'智能设备',
                    menus:['智能手环','智能家居','智能手表','其他配件']
                },
                {
                    menu_title:'娱乐',
                    menus:['耳机','音响','收音机','麦克风']
                }]
            },
            {
                title:'电脑维修',
                list:[{
                    menu_title:'电脑',
                    menus:['笔记本','平板','一体机']
                },
                {
                    menu_title:'电脑配件',
                    menus:['显示器','CPU','主板','硬盘','电源','显卡','其他配件']
                },
                {
                    menu_title:'游戏设备',
                    menus:['游戏机','耳机','游戏软件']
                },
                {
                    menu_title:'网络产品',
                    menus:['路由器','网络机顶盒','交换机','存储卡','网卡']
                },
                {
                    menu_title:'外部产品',
                    menus:['鼠标','键盘','U盘','移动硬盘','鼠标垫','电脑清洁']
                }]
            },
            {
                title:'家用电器',
                list:[{
                    menu_title:'电视',
                    menus:['国产品牌','日韩品牌','欧美品牌']
                },
                {
                    menu_title:'空调',
                    menus:['显示器','柜式','中央','壁挂式']
                },
                {
                    menu_title:'冰箱',
                    menus:['多门','对开门','三门','双门']
                },
                {
                    menu_title:'洗衣机',
                    menus:['滚筒式洗衣机','迷你洗衣机','洗烘一体机']
                },
                {
                    menu_title:'厨房电器',
                    menus:['油烟机','洗碗机','燃气灶']
                }]
            },
            {
                title:'家具',
                list:[{
                    menu_title:'家纺',
                    menus:['被子','枕头','四件套','床垫']
                },
                {
                    menu_title:'灯具',
                    menus:['台灯','顶灯','节能灯','应急灯']
                },
                {
                    menu_title:'厨具',
                    menus:['烹饪锅具','餐具','菜板刀具']
                },
                {
                    menu_title:'家装',
                    menus:['地毯','沙发垫套','装饰字画','照片墙','窗帘']
                },
                {
                    menu_title:'生活日用',
                    menus:['收纳用品','浴室用品','雨伞雨衣']
                }]
            },
            {
                title:'编程书籍',
                list:[{
                    menu_title:'家纺',
                    menus:['被子','枕头','四件套','床垫']
                },
                {
                    menu_title:'灯具',
                    menus:['台灯','顶灯','节能灯','应急灯']
                },
                {
                    menu_title:'厨具',
                    menus:['烹饪锅具','餐具','菜板刀具']
                },
                {
                    menu_title:'家装',
                    menus:['地毯','沙发垫套','装饰字画','照片墙','窗帘']
                },
                {
                    menu_title:'生活日用',
                    menus:['收纳用品','浴室用品','雨伞雨衣']
                }]
            },
            {
                title:'亲子教育',
                list:[{
                    menu_title:'家纺',
                    menus:['被子','枕头','四件套','床垫']
                },
                {
                    menu_title:'灯具',
                    menus:['台灯','顶灯','节能灯','应急灯']
                },
                {
                    menu_title:'厨具',
                    menus:['烹饪锅具','餐具','菜板刀具']
                },
                {
                    menu_title:'家装',
                    menus:['地毯','沙发垫套','装饰字画','照片墙','窗帘']
                },
                {
                    menu_title:'生活日用',
                    menus:['收纳用品','浴室用品','雨伞雨衣']
                }]
            },
            {
                title:'显微镜',
                list:[{
                    menu_title:'家纺',
                    menus:['被子','枕头','四件套','床垫']
                },
                {
                    menu_title:'灯具',
                    menus:['台灯','顶灯','节能灯','应急灯']
                },
                {
                    menu_title:'厨具',
                    menus:['烹饪锅具','餐具','菜板刀具']
                },
                {
                    menu_title:'家装',
                    menus:['地毯','沙发垫套','装饰字画','照片墙','窗帘']
                },
                {
                    menu_title:'生活日用',
                    menus:['收纳用品','浴室用品','雨伞雨衣']
                }]
            }],

        }
    },

    created() {

    },
    methods: {
        // 显示对应的二级分类菜单
        showSubMenu(index){
            if(index!=-1){
                this.menu_item_index=index;
            }
            document.querySelectorAll('.menu_item')[this.menu_item_index].classList.add('bd1');
            document.querySelector('.sub_menu').classList.remove('hide');
        },

        // 隐藏二级分类菜单
        hideSubMenu(){
            document.querySelectorAll('.menu_item')[this.menu_item_index].classList.remove('bd1');
            document.querySelector('.sub_menu').classList.add('hide');
        },
    }
};
</script>

<style lang="scss" scope>
@import '@/assets/styles/nav'
</style>
